'''
验证码处理的处理方式：
    注释验证码（建议）
    万能码（建议）
    调用图片识别插件
    添加 cookie ，绕过验证
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC  # 起个别名
from time import sleep
from options import options
from service import service

dr=webdriver.Chrome(options=options,service=service)
dr.get(r'https://www.baidu.com/')
dr.maximize_window()
sleep(5)
# 百度网站：BAIDUID 和 BDUSS
cookie1={'name':'BAIDUID','value':'9195EB8BAF1E21D90663C362D533C022:FG=1'}
cookie2={'name':'BDUSS',
         'value':'N3UDBFZm1ERi1jUGZTYzNsSWhPSFRZTkRGTWFEbnVyUjY2Smx0Q3lGRHduTHhsRVFBQUFBJCQAAAAAAAAAAAEAAAD9wuSkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAPlWXwD5VlOU'}
dr.add_cookie(cookie1)
dr.add_cookie(cookie2)
dr.refresh()
sleep(5)
dr.quit()